package com.axxc.jpa.pattendegign.composite;

import java.util.ArrayList;
import java.util.List;

public class Employee {
   private String name;
   private String dept;
   private List<Employee> subordinates;
 
   //构造函数
   public Employee(String name,String dept) {
      this.name = name;
      this.dept = dept;
      subordinates = new ArrayList<Employee>();
   }
 
   public void add(Employee e) {
      subordinates.add(e);
   }
 
   public void remove(Employee e) {
      subordinates.remove(e);
   }
 
   public List<Employee> getSubordinates(){
     return subordinates;
   }
 
	@Override
	public String toString() {
		return "Employee [name=" + name + ", dept=" + dept + "]";
	} 
}